﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace Client
{
    class Program
    {
        static void Main(string[] args)
        {
            ServiceReference1.ServiceClient sc = new ServiceReference1.ServiceClient();


            try
            {
                // Making calls.
                int result = sc.Divede(1, 0);
                Console.WriteLine(result);

                Console.WriteLine("Press ENTER to exit:");
                Console.ReadLine();

                // Done with service. 
                sc.Close();
                Console.WriteLine("Done!");
            }
            catch (TimeoutException timeProblem)
            {
                Console.WriteLine("The service operation timed out. " + timeProblem.Message);
                Console.ReadLine();
                sc.Abort();
            }
            catch (FaultException<ServiceReference1.MathFault> mathgFault)
            {
                Console.WriteLine(mathgFault.Detail.Report);
                Console.ReadLine();
                sc.Abort();
            }
            catch (FaultException unknownFault)
            {
                Console.WriteLine("An unknown exception was received. " + unknownFault.Message);
                Console.ReadLine();
                sc.Abort();
            }
            catch (CommunicationException commProblem)
            {
                Console.WriteLine("There was a communication problem. " + commProblem.Message + commProblem.StackTrace);
                Console.ReadLine();
                sc.Abort();
            }


            Console.ReadLine();
        }
    }
}
